package com.yida.gwj.expend.domain.request;

import java.time.LocalDate;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yida.common.core.exception.ServiceException;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 申请报告请求参数
 *
 * @author liangp
 * @date 2023/02/23
 */
@ApiModel(description = "申请报告请求参数")
public class ApplicationReportRequest {

    // private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键")
    private Long bizid;

    @ApiModelProperty("附件主键")
    private Long attachmentId;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "竣工时间")
    private LocalDate completionTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "公示开始时间")
    private LocalDate publicityStartTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "公示结束时间")
    private LocalDate publicityEndTime;

    @ApiModelProperty(value = "位置信息")
    private String positionInformation;

    @ApiModelProperty(value = "签署报告时间")
    private LocalDate signTime;

    @ApiModelProperty(value = "已勘查业主人数")
    private Integer exploredOwnerNumber;

    public Long getBizid() {
        return bizid;
    }

    public void setBizid(Long bizid) {
        this.bizid = bizid;
    }

    public Long getAttachmentId() {
        return attachmentId;
    }

    public void setAttachmentId(Long attachmentId) {
        this.attachmentId = attachmentId;
    }

    public LocalDate getPublicityEndTime() {
        return publicityEndTime;
    }

    public void setPublicityEndTime(LocalDate publicityEndTime) {
        this.publicityEndTime = publicityEndTime;
    }

    public LocalDate getCompletionTime() {
        return completionTime;
    }

    public void setCompletionTime(LocalDate completionTime) {
        this.completionTime = completionTime;
    }

    public LocalDate getPublicityStartTime() {
        return publicityStartTime;
    }

    public void setPublicityStartTime(LocalDate publicityStartTime) {
        this.publicityStartTime = publicityStartTime;
    }

    public String getPositionInformation() {
        return positionInformation;
    }

    public void setPositionInformation(String positionInformation) {
        this.positionInformation = positionInformation;
    }

    public LocalDate getSignTime() {
        return signTime;
    }

    public void setSignTime(LocalDate signTime) {
        this.signTime = signTime;
    }

    public Integer getExploredOwnerNumber() {
        return exploredOwnerNumber;
    }

    public void setExploredOwnerNumber(Integer exploredOwnerNumber) {
        this.exploredOwnerNumber = exploredOwnerNumber;
    }

    @Override
    public String toString() {
        return "ApplicationReportRequest{" + "bizid=" + bizid + ", attachmentId=" + attachmentId + ", completionTime=" + completionTime + ", publicityStartTime=" + publicityStartTime + ", publicityEndTime=" + publicityEndTime + ", positionInformation='" + positionInformation + '\'' + ", signTime=" + signTime + ", exploredOwnerNumber=" + exploredOwnerNumber + '}';
    }

    public void checkNull() {
        if (ObjectUtil.isNull(completionTime)) {
            throw new ServiceException("竣工时间不能为空");
        }
        if (ObjectUtil.isNull(publicityStartTime)) {
            throw new ServiceException("公示开始时间不能为空");
        }
        if (StrUtil.isBlank(positionInformation)) {
            throw new ServiceException("位置信息不能为空");
        }
    }
}
